package com.borball.store.domain;

import java.io.Serializable;

public class User implements Serializable {

	private static final long serialVersionUID = 1L;

	private String name;
	private String password;
	private String rights;
	private String cardid;
	private String mobile;
	private int status;
	private boolean autoLogin;
	public boolean isAutoLogin() {
		return autoLogin;
	}

	public void setAutoLogin(boolean autoLogin) {
		this.autoLogin = autoLogin;
	}

	public boolean isSavePassword() {
		return savePassword;
	}

	public void setSavePassword(boolean savePassword) {
		this.savePassword = savePassword;
	}

	private boolean savePassword;
	
	public User() {
	}

	public User(String name) {
		this.name = name;
	}
	
	public String getCardid() {
		return cardid;
	}

	public void setCardid(String cardid) {
		this.cardid = cardid;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getRights() {
		return rights;
	}

	public void setRights(String rights) {
		this.rights = rights;
	}

	public boolean haveRight(String right) {
		if (rights != null)
			return rights.contains(right);
		return false;
	}

	public void addRight(String right) {
		if (rights == null)
			rights = new String();
		if (!rights.contains(right))
			rights = right + "," + right;
	}

	public void removeRight(String right) {
		if (haveRight(right)) {
			rights = rights.replace("," + right, "");
		}
	}

}
